package com.own.core.html.component;

import java.lang.reflect.Field;
import java.util.List;

import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;

import com.own.core.html.panel.OwnDynPanel;



public class ListViewUtil {

	public static FormComponent getFormComponent(ListView  listView, String dynName) {

		int count=0;
		List list=listView.getList();
		
		for(Object obj:list){
			Field f=(Field) obj;
			if(f.getName().equals(dynName)){
				break;
			}
			
			count++;
			
		}
		OwnDynPanel ownPanel=	(OwnDynPanel) ((ListItem) listView.get(count)).get(0);
		return ownPanel.getFormComponent();
	}

}
